package com.example.demo.datas;

import com.example.demo.batis.User1Mapper;
import com.example.demo.control.UserBean;
import com.example.demo.datas.data1.Data1UserMapper;
import com.example.demo.datas.data2.Data2UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/datas")
public class UserDatasControl {
    @Nullable
    @Autowired
    Data1UserMapper map1;
    @Nullable
    @Autowired
    Data2UserMapper map2;
    @Nullable
    @Autowired
    User1Mapper user1Mapper;

    @RequestMapping("/test1")
    public List<UserBean> selectAll1() {
        List<UserBean> userBeans1 = map1.selectAll();
        List<UserBean> userBeans2 = map2.selectAll();
        List<UserBean> userBeans3 = user1Mapper.selectAll();
        ArrayList<UserBean> userBeans = new ArrayList<>();
        userBeans.addAll(userBeans1);
        userBeans.addAll(userBeans2);
        userBeans.addAll(userBeans3);

        return userBeans;
    }

}
